import requests
# data={
#             "data":{'mobilephone':'13413766443','pwd':'213465'},
#             "headers":{"X-lemonban-Media-Type":"lemonban.v1"},
#             "method":'post',
#             "url":'http://test.lemonban.com/futureloan/mvc/api/member/login',
#             "expect":"hell"
#         }
class HttpHandler():
    def __init__(self):
        self.session = requests.Session()
    def visit(self,method,url,params=None,data=None,json=None,**kwargs):
        # print(method,url,params,data,json)
        res = self.session.request(method,url,params=params,data=data,json=json,**kwargs)
        try:
            return res.json()
        except ValueError:
            print(res)
            # print('error')

# req = HttpHandler()
# re = req.visit(method=data['method'],url=data['url'],data=data['data'],headers=data['headers'])
# print(re)
# session = requests.Session()
# res = session.request(method=data['method'],url=data['url'],data=data['data'],headers=data['headers'])
# print(res.text)